package com.ss.android.account.v2.b;

import android.content.Context;
import android.os.Message;
import android.text.TextUtils;

import com.bytedance.common.utility.collection.WeakHandler;
import com.ss.android.account.activity.mobile.d.c;
import com.ss.android.account.activity.mobile.d;
import com.ss.android.common.util.NetworkUtils;

public final class a {
    public d a;
    private Context b;

    public a(Context arg2) {

        this.b = arg2.getApplicationContext();
        this.a = new d(arg2);
    }

    public final boolean a(WeakHandler.Callback arg4) {
        boolean v0_1;
        if(!NetworkUtils.isNetworkAvailable(this.b)) {
            e v0 = new e();
            ((c)v0).a = 12;
            ((c)v0).b = this.b.getString(com.ss.android.article.browser.R.string.jp);
            Message v1 = Message.obtain();
            v1.what = 11;
            v1.obj = v0;
            arg4.handleMsg(v1);
            v0_1 = false;
        }
        else {
            v0_1 = true;
        }

        return v0_1;
    }

    public static String a(String arg2) {
        if(!TextUtils.isEmpty(((CharSequence)arg2))) {
            arg2 = arg2.replaceFirst("^((\\+86)|(86))", "");
        }

        return arg2;
    }

    final String a(c arg3) {
        String v0 = arg3.b;
        if(TextUtils.isEmpty(((CharSequence)v0))) {
            if(!TextUtils.isEmpty(arg3.d)) {
                v0 = arg3.d;
            }
            else if(arg3.a == 12) {
                v0 = this.b.getString(com.ss.android.article.browser.R.string.jp);
            }
            else if(arg3.a == 21) {
                v0 = this.b.getString(com.ss.android.article.browser.R.string.js);
            }
            else {
                v0 = this.b.getString(com.ss.android.article.browser.R.string.jt);
            }
        }

        return v0;
    }
}

